import { createMachine } from "xstate";

export const bill_card_config = {
  id: "bill_card",
  states: {
    "up": {
      initial: "closed",
      states: {
        closed: {
          on: {
            open_up: {
              target: "opened",
            },
          },
        },
        opened: {
          on: {
            close_up: {
              target: "closed",
            },
          },
        },
      },
    },
    "down": {
      initial: "closed",
      states: {
        closed: {
          on: {
            open_down: {
              target: "opened",
            },
          },
        },
        opened: {
          on: {
            close_down: {
              target: "closed",
            },
          },
        },
      },
    },
    "down_all": {
      initial: "closed",
      states: {
        closed: {
          on: {
            open_down_all: {
              target: "opened",
            },
          },
        },
        opened: {
          on: {
            close_down_all: {
              target: "closed",
            },
          },
        },
      },
    },
    "up_all": {
      initial: "closed",
      states: {
        closed: {
          on: {
            open_up_all: {
              target: "opened",
            },
          },
        },
        opened: {
          on: {
            close_up_all: {
              target: "closed",
            },
          },
        },
      },
    },
  },
  type: "parallel",
}

export const bill_card_machine = createMachine(
  bill_card_config,
  {
    actions: {},
    actors: {},
    guards: {},
    delays: {},
  },
);